home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 February / PCWorld_2007-02_cd.bin / domacnost a kancelar / avedesk / AveDesk13.exe / Effects / Rotater.effectlet < prev    next >
Text File  |  2004-10-11  |  5KB  |  186 lines

  1. <!--
  2.   preamble stuff you might say to someone
  3.   willing to open this in a text editor.
  4. -->
  5.  
  6. <?xml version="1.0" encoding="UTF-8"?>
  7. <effectlet>
  8.     <info>
  9.         <name>Rotation Effect Script</name>
  10.         <author>Yursil Kidwai</author>
  11.         <notes><![CDATA[
  12.         Credits to Fabien LAMAISON @ KERIN from who i just basically altered the bounce/shake scripts from
  13.         ]]></notes>
  14.         <version>0.0.7</version>
  15.     </info>
  16.     <settings>
  17.         <param name="Debug" type="Boolean" defval="False"/>
  18.     </settings>
  19.     <preferences>
  20.         <preference name="ReturnStart" type="range"   defval="1" min="0" max="1">
  21.         Return to Starting position on mouse out- 0 is false 1 is true (If left false, eventually there will be a small jitter as it reaches the max rotation, havent spent much time on that yet)
  22.       </preference>
  23.  
  24.     <preference name="AmountofRotation" type="range"   defval="30" min="1" max="100">
  25.         How much rotation will occur with each Speed tick
  26.         </preference>
  27.  
  28.     <preference name="ConstantlyRotate" type="range"   defval="0" min="0" max="1">
  29.         Keep rotating forever - 0 is false, 1 is true ... Warning, with a high speed setting this can hog CPU as much as 50% 
  30.         </preference>
  31.  
  32.         <preference name="Speed" type="range"   defval="150" min="1" max="300">
  33.         Define the speed of the bounce (1 is quick and cpu intensive and 300 is very slow)
  34.       </preference>
  35.     </preferences>
  36.     <images>
  37.     </images>
  38.     <script engine="vbScript"><![CDATA[
  39.  
  40.     Dim Counter
  41.     Dim StartTop, StartLeft
  42.     Dim TickRate
  43.  
  44.     Dim isOver
  45.     Dim isMounting
  46.  
  47.     'These routines are the optional ones called by the framework
  48.     Sub OnCreate()
  49.         isOver = false
  50.         isMounting = true
  51.         TickRate = 100
  52.         Counter = 0
  53.         Speed.value = 80
  54.         ReturnStart = 0
  55.         StartRotation = Desklet.Rotation
  56.         AmountofRotation = 30
  57.         ConstantlyRotate = 0
  58.         'And Reading overwrites them with some previous user changes
  59.         Preferences.ReadAll()
  60.         if ConstantlyRotate = 1 then
  61.             StartTop = Desklet.Rotation
  62.             isMounting = true
  63.             Counter = 0
  64.             Ticker.Interval = Speed.value
  65.             Ticker.Enabled = True
  66.             isOver = true
  67.         end if
  68.  
  69.     End Sub
  70.  
  71.     Sub OnMouseOn()
  72.     StartTop = Desklet.Rotation
  73.     isMounting = true
  74.     Counter = 0
  75.     Ticker.Interval = Speed.value
  76.     Ticker.Enabled = True
  77.     isOver = true
  78.     End Sub
  79.  
  80.     Sub OnMouseout()  
  81.         if ConstantlyRotate = 0 Then
  82.         isOver = false
  83.         Ticker.Enabled = False
  84.         if ReturnStart = 1 then
  85.          Desklet.Rotation = StartTop
  86.          Desklet.Redraw()
  87.         End If
  88.     End If
  89.     End Sub
  90.  
  91.     'Function OnBeforeDraw(IsMouseOn, IsSelected, IsPreview)
  92.     'End Function
  93.  
  94.     'Function OnAfterDraw(IsMouseOn, IsSelected, IsPreview)
  95.     'End Function
  96.     
  97.     Sub OnSave()
  98.         Preferences.SaveAll 
  99.     End Sub
  100.  
  101.     'Optional. Indicates a preference change
  102.     Function OnPreferenceChange(Preference, oldValue, newValue)
  103.         if ConstantlyRotate = 1 then
  104.             StartTop = Desklet.Rotation
  105.             isMounting = true
  106.             Counter = 0
  107.             Ticker.Interval = Speed.value
  108.             Ticker.Enabled = True
  109.             isOver = true
  110.         else 
  111.             isOver = false
  112.             Ticker.Enabled = False
  113.             if ReturnStart = 1 then
  114.              Desklet.Rotation = StartTop
  115.             End If
  116.             Desklet.Redraw()
  117.         end if
  118.     End Function
  119.  
  120.  
  121.     'You can only have 1 Ticker per effectlet
  122.     'The OnTimer method is shielded against multiple entrance recursion
  123.     Sub OnTimer()
  124.         if isMounting then
  125.             if Counter > 277777 then
  126.                 Counter = 0
  127.             else
  128.                       Counter = Counter + AmountofRotation
  129.             End If
  130.             isMounting = true
  131.         End If
  132.         
  133.         Desklet.Rotation = StartTop + Counter
  134.         Desklet.Redraw()
  135.     End Sub
  136.  
  137.     'Optional calls that we don't need for this script:
  138.  
  139.     'Sub OnSelect()   
  140.     'End Sub
  141.  
  142.     'Sub OnDeselect()   
  143.     'End Sub
  144.  
  145.     'Sub OnShow()         
  146.     'End Sub
  147.  
  148.     'Sub OnHide()         
  149.     'End Sub
  150.  
  151.     'Sub OnConfigure() 
  152.         'the configuration dialog with default UI for
  153.         'XML preferences will be shown.
  154.         'An additional dialog designer is on its way. It will
  155.         'extend the available default preferences of type:
  156.         ' - slider, checkbox, combobox (builtin, v. 1.1, free on form with v. 1.2)
  157.         ' - textbox, file browser, favorites URL (builtin and free on form, v. 1.2)
  158.         ' - Any ocx (external, only free on form, v. 1.2)
  159.     'End Sub
  160.  
  161.     Sub OnStartMove() 
  162.         if ConstantlyRotate = 0 Then
  163.             isOver = false
  164.             Ticker.Enabled = False
  165.             Desklet.Rotation = StartTop + Counter
  166.         End if
  167.     End Sub
  168.  
  169.     Sub OnEndMove()
  170.     'OnMouseOn
  171.     End Sub
  172.  
  173.     Sub OnLeftClick()  
  174.     Desklet.Rotation = StartTop + Counter
  175.     End Sub
  176.  
  177.     'Sub OnRightClick()
  178.     'End Sub
  179.  
  180.     'Sub OnDestroy
  181.     'End Sub
  182.  
  183.  
  184.     ]]></script>
  185. </effectlet>
  186.